home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / DEGREE.dxr / 00007.ls < prev    next >
Encoding:
Text File  |  1998-07-22  |  1.4 KB  |  43 lines

  1. on enterFrame
  2.   set xCenter to ((the left of sprite 3 + the right of sprite 3) / 2) + 1
  3.   set yCenter to ((the top of sprite 3 + the bottom of sprite 3) / 2) + 1
  4.   set radius to (the width of sprite 3 / 2) - 2
  5.   if value(field "Degrees") < 0 then
  6.     set the foreColor of sprite 4 to 6
  7.   else
  8.     set the foreColor of sprite 4 to 3
  9.   end if
  10.   puppetSprite(4, 1)
  11.   set the trails of sprite 4 to 1
  12.   if field "Degrees" >= 0 then
  13.     repeat with n = 0 to field "Degrees"
  14.       set dy to float(radius) * float(sin((360 - n) * PI / 180.0))
  15.       set dx to float(radius) * float(cos(n * PI / 180.0))
  16.       if n > 360 then
  17.         set the foreColor of sprite 4 to 235
  18.         if value(field "Degrees") < 0 then
  19.           set the foreColor of sprite 4 to 15
  20.         end if
  21.       end if
  22.       drawLine(4, yCenter, xCenter, yCenter + dy, xCenter + dx)
  23.       updateStage()
  24.     end repeat
  25.   else
  26.     set n1 to -1 * field "Degrees"
  27.     repeat with n = 0 to abs(n1)
  28.       set dy to float(radius) * float(sin(n * PI / 180.0))
  29.       set dx to float(radius) * float(cos(n * PI / 180.0))
  30.       if n > 360 then
  31.         set the foreColor of sprite 4 to 235
  32.         if value(field "Degrees") < 0 then
  33.           set the foreColor of sprite 4 to 15
  34.         end if
  35.       end if
  36.       drawLine(4, yCenter, xCenter, yCenter + dy, xCenter + dx)
  37.       updateStage()
  38.     end repeat
  39.   end if
  40.   puppetSprite(4, 0)
  41.   set the trails of sprite 4 to 0
  42. end
  43.